package com.cssw.fyzb.wap.controller;

import com.cssw.fyzb.base.web.context.UserContext;
import com.cssw.fyzb.base.web.domain.AjaxPage;
import com.cssw.fyzb.wap.model.vo.NotifyVo;
import com.cssw.fyzb.wap.service.ImMessageService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author Jian Qin.
 */
@Controller
@RequestMapping("/im")
public class ImMessageController {

    @Autowired
    private ImMessageService imMessageService;

    @ApiOperation(value = "查询at自己的消息")
    @RequestMapping(value = "/listAt", method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNumber", value = "页码, 从1开始", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageSize", value = "页大小", paramType = "query", dataType = "int", required = true),

    })
    @ResponseBody
    public AjaxPage<NotifyVo> listAt(int pageNumber, int pageSize) {
        return imMessageService.listAt(UserContext.get().getUserId(), pageNumber, pageSize);
    }

    @ApiOperation(value = "查询关注自己的消息")
    @RequestMapping(value = "/listFocus", method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNumber", value = "页码, 从1开始", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageSize", value = "页大小", paramType = "query", dataType = "int", required = true),

    })
    @ResponseBody
    public AjaxPage<NotifyVo> listFocus(int pageNumber, int pageSize) {
        return imMessageService.listFocus(UserContext.get().getUserId(), pageNumber, pageSize);
    }


    @ApiOperation(value = "查询评论自己的消息")
    @RequestMapping(value = "/listComment", method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNumber", value = "页码, 从1开始", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageSize", value = "页大小", paramType = "query", dataType = "int", required = true),

    })
    @ResponseBody
    public AjaxPage<NotifyVo> listComment(int pageNumber, int pageSize) {
        return imMessageService.listComment(UserContext.get().getUserId(), pageNumber, pageSize);
    }

    @ApiOperation(value = "查询点赞自己的消息")
    @RequestMapping(value = "/listLike", method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNumber", value = "页码, 从1开始", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageSize", value = "页大小", paramType = "query", dataType = "int", required = true),

    })
    @ResponseBody
    public AjaxPage<NotifyVo> listLike(int pageNumber, int pageSize) {
        return imMessageService.listLike(UserContext.get().getUserId(), pageNumber, pageSize);
    }
}
